package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description:
 * @Author: WD created on 2021-09-22 15:42
 * @Version:
 */


@ControllerAdvice
public class ExceptionControllerAdvise {


    @ExceptionHandler(AuthorizationException.class)
    @ResponseBody
    public BaseRespVo handlerAuthorException(Exception e) {
        System.out.println("没有权限！！");
        return BaseRespVo.fail("没有权限");
    }


//    @ExceptionHandler(NullPointerException.class)
//    @ResponseBody
//    public BaseRespVo handlerNullPointException(Exception e) {
//
//        return BaseRespVo.fail("空指针异常，请联系管理员");
//    }

}
